#pragma once
enum{
	CLR_NROMAL = 1,
	CLR_FAILED = 1<<1,
	CLR_SUCCED = 1<<2,
	FONT_NORMAL = 1<<3,
	FONT_BOLD = 1<<4,
};
class LogReceiver{
public:
	virtual void Log(LPCTSTR lpLogStr, int nFormat = CLR_NROMAL|FONT_NORMAL) = 0;
};
class StateMangr{
public:
	virtual void SetState(BOOL bEnable) = 0;
};

class CWorking
{
public:
	CWorking(LPCTSTR lpCfgFile, StateMangr * pStateMangr = NULL);
	~CWorking(void);
	void SetLogReceiver(LogReceiver* pRev);
	LogReceiver* GetLogReceiver();
	BOOL Begin();
	void Log(LPCTSTR lpLogStr, int nFormat = CLR_NROMAL|FONT_NORMAL);
	void Verify(LPCTSTR lpSrcFile, LPCTSTR lpDstFile);
	static DWORD WINAPI WorkingThread(LPVOID  param);
	static DWORD WINAPI DwnLoadThread(LPVOID  param);
public:
	HANDLE m_hSemaphore;
	LogReceiver* m_pLogReceiver;
	StateMangr* m_pStateMangr;
	CString m_strCfgFile;
};

